﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;

public partial class Web_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        InitRept();
    }

    private void InitRept()
    {
        try
        {
            DataTable dt = new DataTable("ZDH1");
            dt.Columns.Add("Ku");
            dt.Columns.Add("Ysjh");
            dt.Columns.Add("Zzjh");
            dt.Columns.Add("Good");
            dt.Columns.Add("Bad");
            dt.Columns.Add("Yb");
            dt.Columns.Add("Bb");
            dt.Columns.Add("Nyb");
            dt.Columns.Add("Dk");
            dt.Columns.Add("Lt"); 
            dt.Columns.Add("Jhcq");



            DataRow NewRow = dt.NewRow();
            NewRow["Ku"] = "111";
            NewRow["Ysjh"] = "222";
            NewRow["Zzjh"] = "333";
            NewRow["Good"] = "444";
            NewRow["Bad"] = "111";
            NewRow["Yb"] = "222";
            NewRow["Bb"] = "333";
            NewRow["Nyb"] = "444";
            NewRow["Dk"] = "111";
            NewRow["Lt"] = "222";
            NewRow["Jhcq"] = "333";

         
            dt.Rows.Add(NewRow);

            DataTable dt2 = new DataTable("ZDH2");
            dt2.Columns.Add("Ku");
            dt2.Columns.Add("Rk");
            dt2.Columns.Add("Ck");
            dt2.Columns.Add("Kc");

            DataRow NewRow2 = dt2.NewRow();
            NewRow2["Ku"] = "111";
            NewRow2["Rk"] = "222";
            NewRow2["Ck"] = "333";
            NewRow2["Kc"] = "444";
            dt2.Rows.Add(NewRow2);
          

            DataTable dt3 = new DataTable("ZDH3");


            DataTable dt4 = new DataTable("ZDH4");



            ReportDocument rptc = new ReportDocument();
            string rptFile = Server.MapPath("../report/ZDHHB.rpt");
            rptc.Load(rptFile);
            rptc.Database.Tables[0].SetDataSource(dt);
            rptc.Database.Tables[1].SetDataSource(dt2);
            rptc.Database.Tables[2].SetDataSource(dt3);
            rptc.Database.Tables[3].SetDataSource(dt4);
            this.crystalReportViewer1.ReportSource = rptc;
           
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
           
        }
    }
}
